package com.jianzong.lingxuan.error;

/**
 * 自定义异常断言
 * @author xuyanbo
 * @date 2020/6/29
 */
public class Asserts {

    /**
     * 表达式不成立即断言
     * @param expression
     * @param message
     */
    public static void fails(boolean expression, String message) {
        if(!expression) {
            throw new CustomException(message);
        }
    }

    /**
     * 自定义错误断言异常
     * @param error　
     */
    public static void fails(boolean expression, IError error) {
        if(!expression) {
            throw new CustomException(error);
        }
    }

}

